﻿using Gonte.Reflection;

namespace Gonte.Workflow.Tasks
{
    public class GetProperty
        : GetAccessor
    {
        public override TaskResult Execute(TaskContext context)
        {
            TaskResult result = base.Execute(context);
            TypeAccessor typeAccessor = (TypeAccessor)result.Value;
            object data = result.AditionalValues[Data];

            result = new TaskResult();
            result.Value = typeAccessor.GetValue(data, _property);

            return result;
        }
    }
}
